from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth import views as auth_views
from django.contrib.auth import logout
from django.shortcuts import redirect
from django.views.generic import ListView, TemplateView
from django.contrib.auth.models import User

def index(request):
    return HttpResponse(render(request, "index/index.html"))


class LoginView(auth_views.LoginView):
        template_name = 'index/login.html'
        redirect_authenticated_user = True

class NeedLoginView(TemplateView):
    template_name = "index/login_error.html"

def logoutView(request):
    logout(request)
    # Redirect to a success page.
    return redirect('index:index')
